package random

import (
	"math/rand"
	"strconv"
	"strings"
	"time"
)

// 创建名称
func CreateName() string {
	str := RandString(6)
	name := strconv.FormatInt(time.Now().Unix(), 10)
	newStr := str[:2] + name[4:] + str[3:]
	return newStr
}

var seed int = 1

// RandString 获取多个随机字符
func RandString(i int) string {
	seed++
	var result = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
	var arr = strings.Split(result, "")
	rand.Seed(time.Now().Unix() + int64(seed))
	var str string
	for m := 0; m < i; m++ {
		str += arr[rand.Intn(len(arr))]
	}
	return str
}
